package cn.xiyue.boxuegu.base;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class BaseActivity extends AppCompatActivity {
    private Toast toast;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    protected void showMsg(String msg){
        if (toast!=null){
            toast.cancel();
        }
        toast = Toast.makeText(this,msg,Toast.LENGTH_SHORT);
        toast.show();
    }

    protected SharedPreferences getSP(){
        return getSharedPreferences("loginInfo",MODE_PRIVATE);
    }

    protected SharedPreferences.Editor getSPEditor(){
        return getSharedPreferences("loginInfo",MODE_PRIVATE).edit();
    }
}
